import axios from '../../axios';
const ORDERS_URL = "/orders"

const ordersApi = {
    //获得所有订单
    getAllOrders(data) {
        return axios({
            url: ORDERS_URL + "/getAllOrders",
            method: "get",
            params: data
        });
    },

    //获得一个订单的详情
    getOneOrderInfo(data) {
        return axios({
            url: ORDERS_URL + "/getOneOrderDetail",
            method: "get",
            params: data
        });
    },

    //获取请求退款的订单列表
    getRefoundList(data) {
        return axios({
            url: "/orders/getRefoundOrders",
            method: "get",
            params: data
        });
    },

    //同意该订单退款（修改订单状态为退款）
    ChangeOrderToRefound(data) {
        return axios({
            url: "/orders/changeStateToRefound",
            method: "post",
            params: data
        })
    },

    //获得销售员的订单列表
    getSalesmanOrder(data) {
        return axios({
            url: ORDERS_URL + "/getOrdersBySalesman",
            method: "get",
            params: data
        });
    },

    //删除一个订单
    deleteOneOrderById(data) {
        return axios({
            url: ORDERS_URL + "/deleteOneOrder",
            method: "post",
            data
        });
    },
};
export default ordersApi;